import 'package:flutter/material.dart';
import './textInput.dart';

class Input extends Column{

  Input({
    super.key,
    String? label,
    double? fontSize,
    FontWeight? fontWeight,
    String? placeholder,
    Widget? suffixIcon,
    Color? prefixIconColor,
    void Function()? onTap,
    TextEditingController? controller,
    FormFieldValidator? validator,
    void Function(String value)? onChanged,
    FocusNode? focusNode,
    void Function()? onClick,
    bool? enabled = true,
    String? initialValue,
    bool? readOnly = false,
    double? labelWidth,
    TextAlign? textAlign,
    AlignmentGeometry? labelAlignment,
    bool? obscureText,
    Function(String value)? onEntry
  }):
      super(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
            DecoratedBox(
              decoration: const BoxDecoration(
                border: Border(),
            ),
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Flexible(
                  flex: 1,
                    child: Container(
                      height: 48.45,
                      width: labelWidth,
                      alignment: labelAlignment,
                      decoration: const BoxDecoration(
                        border: Border(
                          bottom: BorderSide(color: Color.fromARGB(255, 243, 243, 243), width: 1.0), // 设置下边框样式
                        ),
                      ),
                      child: Padding(
                          padding:const EdgeInsets.only(left: 10, right: 10, top: 11),
                          child: Text(
                              label??'',
                              style: TextStyle(
                                fontSize: fontSize??16,
                                fontWeight: fontWeight??FontWeight.w600,
                                color: const Color.fromARGB(255, 128, 128, 128),
                              )
                          )
                      ),
                    ),
                ),
                Flexible(
                  flex: 3,
                  child: TextInput(
                    onEntry: onEntry,
                    validator: validator,
                    controller: controller,
                    onChanged: onChanged,
                    focusNode: focusNode,
                    enabled: enabled,
                    readOnly: readOnly,
                    initialValue: initialValue,
                    onClick: onClick,
                    placeholder: placeholder,
                    suffixIcon: suffixIcon,
                    textAlign: textAlign,
                    onTap: onTap,
                    obscureText: obscureText,
                    prefixIconColor: prefixIconColor,
                  ),
                )
              ],
            ),
          )
        ]
      );
}